import type { RouteRecordRaw } from 'vue-router'
import { defaultRoutes } from '@/router/routes'

/**
 * staticRouter(静态路由)
 */
export const staticRouter: RouteRecordRaw[] = [
  {
    path: '/account',
    name: 'Account',
    meta: {
      title: '账户',
      open: true,
      hidden: false,
      target: '_blank',
      isLeaf: true,
      icon: '',
    },
    component: defaultRoutes.get('AccountRouter'),
    redirect: '/account/login',
    children: [
      {
        path: '/account/login',
        name: 'AccountLogin',
        meta: {
          title: '登录页',
          open: true,
          hidden: false,
          target: '_blank',
          isLeaf: true,
          icon: '',
        },
        component: defaultRoutes.get('AccountLogin'),
      },
      {
        path: '/account/register',
        name: 'AccountRegister',
        meta: {
          title: '注册页',
          open: true,
          hidden: false,
          target: '_blank',
          isLeaf: true,
          icon: '',
        },
        component: defaultRoutes.get('AccountRegister'),
      },
      {
        path: '/account/forget',
        name: 'AccountForget',
        meta: {
          title: '忘记密码',
          open: true,
          hidden: false,
          target: '_blank',
          isLeaf: true,
          icon: '',
        },
        component: defaultRoutes.get('AccountForget'),
      },
      {
        path: '/account/lock',
        name: 'AccountLock',
        meta: {
          title: '锁定',
          open: true,
          hidden: false,
          target: '_blank',
          isLeaf: true,
          icon: '',
        },
        component: defaultRoutes.get('AccountLock'),
      },
      {
        path: '/account/redirect',
        name: 'AccountRedirect',
        meta: {
          title: '回调页',
          open: true,
          hidden: false,
          target: '_blank',
          isLeaf: true,
          icon: '',
        },
        component: defaultRoutes.get('AccountRedirect'),
      },
    ],
  },
]

/**
 * errorRouter(错误页面路由)
 */
export const errorRouter = [
  {
    path: '/error',
    name: 'Error',
    meta: {
      title: '错误页',
      open: true,
      hidden: false,
      target: '_blank',
      isLeaf: true,
      icon: '',
    },
    component: defaultRoutes.get('LMain'),
    children: [
      {
        path: '/error/403',
        name: 'Error403',
        meta: {
          title: '未授权',
          open: true,
          hidden: false,
          target: '_blank',
          isLeaf: true,
          icon: '',
        },
        component: defaultRoutes.get('Error403'),
      },
      {
        path: '/error/404',
        name: 'Error404',
        meta: {
          title: '页面未找到',
          open: true,
          hidden: false,
          target: '_blank',
          isLeaf: true,
          icon: '',
        },
        component: defaultRoutes.get('Error404'),
      },
      {
        path: '/error/500',
        name: 'Error500',
        meta: {
          title: '系统错误',
          open: true,
          hidden: false,
          target: '_blank',
          isLeaf: true,
          icon: '',
        },
        component: defaultRoutes.get('Error500'),
      },
      {
        path: '/error/developing',
        name: 'ErrorDeveloping',
        meta: {
          title: '开发中',
          open: true,
          hidden: false,
          target: '_blank',
          isLeaf: true,
          icon: '',
        },
        component: defaultRoutes.get('ErrorDeveloping'),
      },
    ],
  },
]

/**
 * notFoundRouter(找不到路由)
 */
export const notFoundRouter = {
  path: '/:pathMatch(.*)*',
  name: 'NotFound',
  meta: {
    title: '通配页',
    open: true,
    hidden: false,
    target: '_blank',
    isLeaf: true,
    icon: '',
  },
  redirect: { name: 'Error404' },
}

/**
 * asyncRouter(异步路由)
 */
export const asyncRouter: RouteRecordRaw[] = [
  {
    path: '/',
    name: 'home',
    meta: {
      title: '工作台',
      open: false,
      hidden: false,
      target: '_blank',
      isLeaf: true,
      icon: 'Monitor',
    },
    redirect: '/wel',
    component: defaultRoutes.get('LContainer'),
    children: [
      {
        path: '/wel',
        name: 'AdminWelPage',
        meta: {
          title: '工作台',
          open: false,
          hidden: false,
          target: '_blank',
          isLeaf: true,
          icon: '',
        },
        component: defaultRoutes.get('AdminWelPage'),
      },
      {
        path: '/admin/setting',
        name: 'AdminSettingPage',
        meta: {
          title: '个人设置',
          open: false,
          hidden: false,
          target: '_blank',
          isLeaf: true,
          icon: '',
        },
        component: defaultRoutes.get('AdminSettingPage'),
      },
      {
        path: '/admin/personal',
        name: 'AdminPersonalPage',
        meta: {
          title: '个人中心',
          open: false,
          hidden: false,
          target: '_blank',
          isLeaf: true,
          icon: '',
        },
        component: defaultRoutes.get('AdminPersonalPage'),
      },
    ],
  },
  {
    path: '/idt',
    name: 'IdtPage',
    meta: {
      title: '身份管理',
      open: false,
      display: true,
      hidden: false,
      target: '_blank',
      isLeaf: false,
      icon: 'SetUp',
    },
    component: defaultRoutes.get('LContainer'),
    children: [
      {
        path: '/idt/user',
        name: 'IdtUserPage',
        meta: {
          title: '用户管理',
          open: false,
          display: true,
          hidden: false,
          target: '_blank',
          isLeaf: true,
          icon: '',
        },
        component: defaultRoutes.get('IdtUser'),
      },
      {
        path: '/idt/org',
        name: 'IdtOrgPage',
        meta: {
          title: '组织管理',
          open: false,
          display: true,
          hidden: false,
          target: '_blank',
          isLeaf: true,
          icon: '',
        },
        component: defaultRoutes.get('IdtOrg'),
      },
      {
        path: '/idt/user_type',
        name: 'IdtUserTypePage',
        meta: {
          title: '用户类型',
          open: false,
          display: true,
          hidden: false,
          target: '_blank',
          isLeaf: true,
          icon: '',
        },
        component: defaultRoutes.get('IdtUserType'),
      },
      {
        path: '/idt/org_type',
        name: 'IdtOrgTypePage',
        meta: {
          title: '组织类型',
          open: false,
          display: true,
          hidden: false,
          target: '_blank',
          isLeaf: true,
          icon: '',
        },
        component: defaultRoutes.get('IdtOrgType'),
      },
      {
        path: '/idt/job',
        name: 'IdtJobPage',
        meta: {
          title: '岗位管理',
          open: false,
          display: true,
          hidden: false,
          target: '_blank',
          isLeaf: true,
          icon: '',
        },
        component: defaultRoutes.get('IdtJob'),
      },
      {
        path: '/idt/group',
        name: 'IdtGroupPage',
        meta: {
          title: '分组管理',
          open: false,
          display: true,
          hidden: false,
          target: '_blank',
          isLeaf: true,
          icon: '',
        },
        component: defaultRoutes.get('IdtGroup'),
      },
    ],
  },
  {
    path: '/pow',
    name: 'PowPage',
    meta: {
      title: '权限管理',
      open: false,
      display: true,
      hidden: false,
      target: '_blank',
      isLeaf: false,
      icon: 'Key',
    },
    component: defaultRoutes.get('LContainer'),
    children: [
      {
        path: '/idt/role',
        name: 'PowRolePage',
        meta: {
          title: '角色管理',
          open: false,
          display: true,
          hidden: false,
          target: '_blank',
          isLeaf: true,
          icon: '',
        },
        component: defaultRoutes.get('PowRole'),
      },
      {
        path: '/idt/menu',
        name: 'PowMenuPage',
        meta: {
          title: '菜单管理',
          open: false,
          display: true,
          hidden: false,
          target: '_blank',
          isLeaf: true,
          icon: '',
        },
        component: defaultRoutes.get('PowMenu'),
      },
      {
        path: '/idt/menu_group',
        name: 'PowMenuGroupPage',
        meta: {
          title: '菜单分组',
          open: false,
          display: true,
          hidden: false,
          target: '_blank',
          isLeaf: true,
          icon: '',
        },
        component: defaultRoutes.get('PowMenuGroup'),
      },
      {
        path: '/idt/datascope',
        name: 'PowDatascopePage',
        meta: {
          title: '数据权限',
          open: false,
          display: true,
          hidden: false,
          target: '_blank',
          isLeaf: true,
          icon: '',
        },
        component: defaultRoutes.get('PowDatascope'),
      },
      {
        path: '/idt/apiscope',
        name: 'PowApiscopePage',
        meta: {
          title: '接口权限',
          open: false,
          display: true,
          hidden: false,
          target: '_blank',
          isLeaf: true,
          icon: '',
        },
        component: defaultRoutes.get('PowApiscope'),
      },
    ],
  },
  {
    path: '/sys',
    name: 'SysPage',
    meta: {
      title: '系统管理',
      open: false,
      display: true,
      hidden: false,
      target: '_blank',
      isLeaf: false,
      icon: 'Key',
    },
    component: defaultRoutes.get('LContainer'),
    children: [
      {
        path: '/sys/area',
        name: 'SysAreaPage',
        meta: {
          title: '区域管理',
          open: false,
          display: true,
          hidden: false,
          target: '_blank',
          isLeaf: true,
          icon: '',
        },
        component: defaultRoutes.get('SysArea'),
      },
      {
        path: '/sys/config',
        name: 'SysConfigPage',
        meta: {
          title: '系统配置',
          open: false,
          display: true,
          hidden: false,
          target: '_blank',
          isLeaf: true,
          icon: '',
        },
        component: defaultRoutes.get('SysConfig'),
      },
    ],
  },
  {
    path: '/dev',
    name: 'Dev',
    meta: {
      title: '开发中心',
      open: false,
      display: true,
      hidden: false,
      target: '_blank',
      isLeaf: false,
      icon: 'Cpu',
    },
    component: defaultRoutes.get('LContainer'),
    children: [
      {
        path: '/dev/datasource',
        name: 'DevDatasource',
        meta: {
          title: '数据源管理',
          open: false,
          display: true,
          hidden: false,
          target: '_blank',
          isLeaf: true,
          icon: '',
        },
        component: defaultRoutes.get('DevDatasource'),
      },
      {
        path: '/dev/datatable',
        name: 'DevDatatable',
        meta: {
          title: '数据表管理',
          open: false,
          display: true,
          hidden: false,
          target: '_blank',
          isLeaf: true,
          icon: '',
        },
        component: defaultRoutes.get('DevDatatable'),
      },
    ],
  },
  {
    path: '/demo/app',
    name: 'DemoApp',
    meta: {
      title: '演示应用',
      open: false,
      display: true,
      hidden: false,
      target: '_blank',
      isLeaf: false,
      icon: 'DataBoard',
    },
    component: defaultRoutes.get('LContainer'),
    children: [
      {
        path: '/demo/app/one',
        name: 'DemoAppOne',
        meta: {
          title: '应用一',
          open: false,
          display: true,
          hidden: false,
          target: '_blank',
          isLeaf: true,
          icon: '',
        },
        component: defaultRoutes.get('DemoAppOne'),
      },
      {
        path: '/demo/app/two',
        name: 'DemoAppTwo',
        meta: {
          title: '应用二',
          open: false,
          display: true,
          hidden: false,
          target: '_blank',
          isLeaf: true,
          icon: '',
        },
        component: defaultRoutes.get('DemoAppTwo'),
      },
      {
        path: '/demo/app/three',
        name: 'DemoAppThree',
        meta: {
          title: '应用三',
          open: false,
          display: true,
          hidden: false,
          target: '_blank',
          isLeaf: true,
          icon: '',
        },
        component: defaultRoutes.get('DemoAppThree'),
      },
    ],
  },
  {
    path: '/demo/table',
    name: 'DemoTable',
    meta: {
      title: '演示表格',
      open: false,
      display: true,
      hidden: false,
      target: '_blank',
      isLeaf: false,
      icon: 'Memo',
    },
    component: defaultRoutes.get('LContainer'),
    children: [
      {
        path: '/demo/table/advancedtable',
        name: 'DemoTableAdvancedTable',
        meta: {
          title: '高级表格',
          open: false,
          display: true,
          hidden: false,
          target: '_blank',
          isLeaf: true,
          icon: '',
        },
        component: defaultRoutes.get('DemoTableAdvancedTable'),
      },
      {
        path: '/demo/table/treetable',
        name: 'DemoTableTreeTable',
        meta: {
          title: '树表格',
          open: false,
          display: true,
          hidden: false,
          target: '_blank',
          isLeaf: true,
          icon: '',
        },
        component: defaultRoutes.get('DemoTableTreeTable'),
      },
    ],
  },
]
